package com.ssextjs.component;

import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;

import com.ssextjs.engine.ConfiguraionImpl;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class Button extends Component{
	public String text="";
	public String iconCls="";
	public String linkUrl="#";
	public String JSFunc="";
	public String QuickTip="";
	public boolean enable=true;
	
	public Button(String text) {
		this.text=text;
	}
	
	public Button(String text,String iconCls,String linkUrl,String JSFunc) {
		this.text=text;
		this.iconCls=iconCls;
		this.linkUrl=linkUrl;
		this.JSFunc=JSFunc;
		tplInit();
	}
	
	public void tplInit() {
		try {
			tpl = ConfiguraionImpl.getCfg().getTemplate("Button.tpl");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public Button setEnable(boolean fl) {
		this.enable=fl;
		return this;
	}
	
	public Button setText(String text) {
		this.text=text;
		return this;
	}
	
	public Button setIconCls(String cls) {
		this.iconCls=cls;
		return this;
	}
	
	public Button setLinkUrl(String url) {
		this.linkUrl=url;
		return this;
	}
	
	public Button setJSFunc(String JSFunc) {
		this.JSFunc=JSFunc;
		return this;
	}
	
	public Button setQuickTip(String qt) {
		this.QuickTip=qt;
		return this;
	}
}
